import { DataSource } from "typeorm";
import { Manager } from "@/models/Manager";
import { Role } from "@/models/Role";
import { Permission } from "@/models/Permission";
import { Store } from "@/models/Store";
import { Category } from "@/models/Category";
import { Product } from "@/models/Product";
import { Image } from "@/models/Image";
import { User } from "@/models/User";

const AppDataSource = new DataSource({
  type: "mysql",
  host: process.env.DB_HOST,
  port: Number(process.env.DB_PORT),
  username: process.env.DB_USER,
  password: process.env.DB_PASS,
  database: process.env.DB_NAME,
  entities: [Manager, Role, Permission, Store, Category, Product, Image, User],
  synchronize: true,
  logging: false,
});

export default AppDataSource;
